import {
	createRouter,
	createWebHashHistory
} from 'vue-router'
import layout from '@/layout/index.vue'; // 引入布局页面
import login from '@/views/admin/login.vue';
import index from '@/views/index/index.vue';

const routes = [
	{
		path: '/login',
		name: '登录',
		component: login,
		hidden: true,
	},
	{
		path: '/',
		component: layout,
		name: 'menu.t1',
		title: '后台管理',
		min_title:'后台',
		icon: '\ue638',
		children: [{
				path: '/',
				title: '后台首页',
				name: 'menu.t2',
				component: index
			},
			{
				path: '/config',
				title: '系统配置',
				name: 'menu.t3',
				component: () => import('@/views/config/index.vue'),
			},
			{
				path: '/form_list',
				title: '表单管理',
				name: 'menu.t31',
				component: () => import('@/views/index/form_list.vue'),
			},
			{
				path: '/ico',
				title: '字体图标库',
				name: 'menu.t5',
				component: () => import('@/views/index/ico.vue'),
			}
		]
	},
	{
		path: '/',
		component: layout,
		title: '页面管理',
		name: 'menu.t8',
		icon: '\ue645',
		min_title:'产品',
		children: [{
				path: '/page',
				title: '页面列表',
				name: 'menu.t17',
				component: () => import('@/views/page/list.vue'),
			},
			{
				path: '/page/type',
				title: '页面分类',
				name: 'menu.t18',
				component: () => import('@/views/page/type.vue'),
			}
		]
	},
	{
		path: '/',
		component: layout,
		title: '产品管理',
		name: 'menu.t9',
		icon: '\ue636',
		min_title:'产品',
		children: [{
				path: '/goods',
				title: '产品列表',
				name: 'menu.t10',
				component: () => import('@/views/goods/list.vue'),
			},
			{
				path: '/goods/type',
				title: '产品分类',
				name: 'menu.t14',
				component: () => import('@/views/goods/type.vue'),
			}
		]
	},
	{
		path: '/',
		component: layout,
		title: '资讯管理',
		name: 'menu.t6',
		icon: '\ue635',
		min_title:'资讯',
		children: [{
				path: '/news',
				title: '资讯列表',
				name: 'menu.t7',
				component: () => import('@/views/news/list.vue'),
			},
			{
				path: '/news/type',
				title: '资讯分类',
				name: 'menu.t16',
				component: () => import('@/views/news/type.vue'),
			},
		]
	},
	{
		path: '/',
		component: layout,
		title: '图片管理',
		name: 'menu.t29',
		icon: '\ue63f',
		min_title:'日历',
		children: [
			// {
			// 	path: '/img_list',
			// 	title: '七牛云图片管理',
			// 	name: 'menu.t4',
			// 	component: () => import('@/views/img/img_list.vue'),
			// },
			{
				path: '/img_list_local',
				title: '服务器图片管理',
				name: 'menu.t15',
				component: () => import('@/views/img/img_list_local.vue'),
			},
			{
				path: '/img-test',
				title: '本地图片选择测试',
				name: 'menu.t23',
				component: () => import('@/views/img/test.vue'),
			}
		]
	},
	{
		path: '/',
		component: layout,
		name: 'menu.t11',
		hidden: true,
		children: [	
			{
				path: '/pass',
				name: '修改密码',
				component:() => import('@/views/admin/pass.vue')
			},
			{
				path: '/search',
				name: '搜索',
				component:() => import('@/views/admin/search.vue')
			},
			{
			    path: '/404',
			    component: () => import('@/views/admin/404.vue')
			},
			{
				path: '/:pathMatch(.*)',
				redirect: '/404'
			}
		]
	},
]

const router = createRouter({
	history: createWebHashHistory(),
	routes
})

export default router
